home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / strstr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  386 b   |  30 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. #undef strstr
  6.  
  7. char *strstr(const char *s1, const char *s2)
  8.  
  9. {
  10.   const char *c1;
  11.   const char *c2;
  12.  
  13.   do
  14.     {
  15.       c1=s1;
  16.       c2=s2;
  17.       while(*c1!='\0' && *c1==*c2)
  18.     {
  19.       c1++;
  20.       c2++;
  21.     }
  22.       if(*c2=='\0')
  23.     {
  24.       return (char *)s1;
  25.     }
  26.     }
  27.   while(*s1++!='\0');
  28.   return NULL;
  29. }
  30.